/**
 * Program  : ViewPagerAdapter.java
 * Author   : qianj
 * Create   : 2012-6-12 下午2:39:45
 *
 * Copyright 2012 by newyulong Technologies Ltd.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information
 * of newyulong Technologies Ltd.("Confidential Information").  
 * You shall not disclose such Confidential Information and shall 
 * use it only in accordance with the terms of the license agreement 
 * you entered into with newyulong Technologies Ltd.
 *
 */

package cn.colorful.olympic.adapter;

import java.util.List;

import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;

/**
 * 
 * @author   qianj
 * @version  1.0.0
 * @2012-6-12 下午2:39:45
 */
public class ViewPagerAdapter extends PagerAdapter{

	private List<View> list;

	public ViewPagerAdapter(List<View> list) {
		this.list = list;
	}

	@Override
    public void destroyItem(View view, int position, Object arg2) {
        ViewPager pViewPager = ((ViewPager) view);
        pViewPager.removeView(list.get(position));
    }

    @Override
    public void finishUpdate(View arg0) {
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object instantiateItem(View view, int position) {
        ViewPager pViewPager = ((ViewPager) view);
        pViewPager.addView(list.get(position));
        return list.get(position);
    }

    @Override
    public boolean isViewFromObject(View arg0, Object arg1) {
        return arg0 == arg1;
    }

    @Override
    public void restoreState(Parcelable arg0, ClassLoader arg1) {
    }

    @Override
    public Parcelable saveState() {
        return null;
    }

    @Override
    public void startUpdate(View arg0) {
    }


}

